pallet-xcm::transfer_assets_using_type_and_then() supports custom actions on destination#4260
Merged
acatangiu merged 4 commits intoApr 24, 2024
Conversation
…estination Change `transfer_assets_using_type()` to not assume `DepositAssets` as the intended use of the assets on the destination. Instead provides the caller with the ability to specify custom XCM that be executed on `dest` chain as the last step of the transfer, thus allowing custom usecases for the transferred assets. E.g. some are used/swapped/etc there, while some are sent further to yet another chain. Note: this is an API change for `transfer_assets_using_type()`, but it is ok as the previous version has not been yet released. Thus, its first release will include the new API proposed by this PR. Signed-off-by: Adrian Catangiu <adrian@parity.io>
6a07074 to
ee88f2e
Compare
svyatonik
approved these changes
Apr 24, 2024
serban300
reviewed
Apr 24, 2024
| fees_id: Box<VersionedAssetId>, | ||
| remote_fees_id: Box<VersionedAssetId>, | ||
| fees_transfer_type: Box<TransferType>, | ||
| custom_xcm_on_dest: Box<VersionedXcm<()>>, |
Contributor
There was a problem hiding this comment.
Sorry, I don't have much context regarding this change. A couple of questions. Not sure if they make sense:
- Should this be a blob ? Just as we did for
sendandexecute? - Isn't it risky to allow the user to perform arbitrary xcm execution here ?
- Nit: seems unexpected to pass a
custom_xcm_on_desthere. Partially because of the name.transfer_assets_using_typemakes me think automatically of the asset being deposited at the destination chain. And also because the other transfer-related extrinsics seem to deposit the assets from what I understand. Maybe renaming the method to something liketransfer_assets_using_type_and_thenwould make this more clear.
Contributor
Author
There was a problem hiding this comment.
- With [Tracking issue]
UncheckedExtrinsicdecoding improvements #4255 we don't need the blob hack anymore. - No, a
ClearOriginis run before these user-controlled instructions. Only thing they can do is operate on the holding register (which they loaded in the first place). - Yes, I like the name suggestion will rename to
transfer_assets_using_type_and_then
bkontur
approved these changes
Apr 24, 2024
Contributor
Author
|
@bkontur @serban300 I made the suggested changes, edited the prdoc from the original PR, and added emulated tests. PTAL |
serban300
approved these changes
Apr 24, 2024
bkontur
approved these changes
Apr 24, 2024
This was referenced Jun 5, 2024
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continuation of #3695
Change
transfer_assets_using_type_and_then()to not assumeDepositAssetsas the intended use of the assets on the destination.Instead provides the caller with the ability to specify custom XCM that be executed on
destchain as the last step of the transfer, thus allowing custom usecases for the transferred assets. E.g. some are used/swapped/etc there, while some are sent further to yet another chain.Note: this is a follow-up on #3695, bringing in an API change (and rename) for
transfer_assets_using_type(). This is ok as the previous version has not been yet released. Thus, its first release will include the new API proposed by this PR.This allows usecases such as: https://forum.polkadot.network/t/managing-sas-on-multiple-reserve-chains-for-same-asset/7538/4
BTW: all this pallet-xcm asset transfers code will be massively reduced once we have polkadot-fellows/xcm-format#54